package com.xiaodu.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
import java.io.IOException;

/**
 * @author: dutianjie
 * @date: 2021/4/15
 * @version: v1.0.0
 * @description: 描述
 **/
@WebFilter(value = "/test/*", filterName = "myServletFilter1",
        initParams ={
        @WebInitParam(name = "filer1", value = "filer1-Value")
        }
)
public class MyServletFilter1 implements Filter {
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.out.println("过滤前。。。 myFilter 1");

        chain.doFilter(request, response);

        System.out.println("过滤后。。。 myFilter 1");
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        String filer1 = filterConfig.getInitParameter("filer1");
        System.out.println("myFilter1 initParam = " + filer1);
    }
}
